home *** CD-ROM | disk | FTP | other *** search
- /* acan.f -- translated by f2c (version of 3 February 1990 3:36:42).
- You must link the resulting object file with the libraries:
- -lF77 -lI77 -lm -lc (in that order)
- */
-
- #include "f2c.h"
-
- /* Common Block Declarations */
-
- struct {
- integer ielmnt, isbckt, nsbckt, iunsat, nunsat, itemps, numtem, isens,
- nsens, ifour, nfour, ifield, icode, idelim, icolum, insize,
- junode, lsbkpt, numbkp, iorder, jmnode, iur, iuc, ilc, ilr,
- numoff, isr, nmoffc, iseq, iseq1, neqn, nodevs, ndiag, iswap,
- iequa, macins, lvnim1, lx0, lvn, lynl, lyu, lyl, lx1, lx2, lx3,
- lx4, lx5, lx6, lx7, ld0, ld1, ltd, imynl, imvn, lcvn, nsnod,
- nsmat, nsval, icnod, icmat, icval, loutpt, lpol, lzer, irswpf,
- irswpr, icswpf, icswpr, irpt, jcpt, irowno, jcolno, nttbr, nttar,
- lvntmp;
- } tabinf_;
-
- #define tabinf_1 tabinf_
-
- struct {
- doublereal atime, aprog[3], adate, atitle[10], defl, defw, defad, defas,
- rstats[50];
- integer iwidth, lwidth, nopage;
- } miscel_;
-
- #define miscel_1 miscel_
-
- struct {
- integer locate[50], jelcnt[50], nunods, ncnods, numnod, nstop, nut, nlt,
- nxtrm, ndist, ntlin, ibr, numvs, numalt, numcyc;
- } cirdat_;
-
- #define cirdat_1 cirdat_
-
- struct {
- doublereal omega, time, delta, delold[7], ag[7], vt, xni, egfet, xmu,
- sfactr;
- integer mode, modedc, icalc, initf, method, iord, maxord, noncon, iterno,
- itemno, nosolv, modac, ipiv, ivmflg, ipostp, iscrch, iofile;
- } status_;
-
- #define status_1 status_
-
- struct {
- integer iprnta, iprntl, iprntm, iprntn, iprnto, limtim, limpts, lvlcod,
- lvltim, itl1, itl2, itl3, itl4, itl5, itl6, igoof, nogo, keof;
- } flags_;
-
- #define flags_1 flags_
-
- struct {
- doublereal twopi, xlog2, xlog10, root2, rad, boltz, charge, ctok, gmin,
- reltol, abstol, vntol, trtol, chgtol, eps0, epssil, epsox, pivtol,
- pivrel;
- } knstnt_;
-
- #define knstnt_1 knstnt_
-
- struct {
- doublereal fstart, fstop, fincr, skw2, refprl, spw2;
- integer jacflg, idfreq, inoise, nosprt, nosout, nosin, idist, idprt;
- } ac_;
-
- #define ac_1 ac_
-
- struct {
- integer maxtim, itime, icost;
- } cje_;
-
- #define cje_1 cje_
-
- struct {
- doublereal value[200000];
- } blank_;
-
- #define blank_1 blank_
-
- /* Table of constant values */
-
- static integer c__0 = 0;
- static integer c__1 = 1;
-
- /* spice version 2g.6 sccsid=acan.ma 3/15/83 */
- /*< subroutine acan >*/
- /* Subroutine */ int acan_()
- {
- /* Format strings */
- static char fmt_121[] = "(\0020warning: underflow \002,i4,\002 time(s) \
- in ac analysis at freq = \002,1pd9.3,\002 hz\002)";
- static char fmt_901[] = "(\0020*error*: cpu time limit exceeded ... ana\
- lysis stopped\002/)";
-
- /* System generated locals */
- integer i_1, i_2, i_3;
- doublereal d_1, d_2;
- complex q_1;
-
- /* Builtin functions */
- integer s_wsfe(), do_fio(), e_wsfe();
-
- /* Local variables */
- static integer loco;
- static doublereal freq;
- static integer iptr, node1, node2;
- extern /* Subroutine */ int getm8_();
- static integer nandd, ibuff;
- extern /* Subroutine */ int acsol_(), getm16_(), dinit_(), noise_();
- static doublereal t1;
- extern /* Subroutine */ int copy16_(), disto_();
- static doublereal t2;
- extern /* Subroutine */ int acload_(), acdcmp_(), getcje_(), pheadr_();
- #define nodplc ((integer *)&blank_1)
- #define cvalue ((complex *)&blank_1)
- extern /* Subroutine */ int second_();
- static integer numcur, numpos, loc, loccur;
- extern /* Subroutine */ int crunch_();
- static integer numout, lcvntp;
- extern /* Subroutine */ int extmem_(), dblsgl_(), fwrite_(), clsraw_(),
- clrmem_();
-
- /* Fortran I/O blocks */
- static cilist io__13 = { 0, 0, 0, fmt_121, 0 };
- static cilist io__18 = { 0, 0, 0, fmt_901, 0 };
-
-
- /*< implicit double precision (a-h,o-z) >*/
-
- /* this routine drives the small-signal analyses. */
-
- /* spice version 2g.6 sccsid=tabinf 3/15/83 */
- /*< common /tabinf/ ielmnt,isbckt,nsbckt,iunsat,nunsat,itemps,numtem, >*/
- /*< 1 isens,nsens,ifour,nfour,ifield,icode,idelim,icolum,insize, >*/
- /*< 2 junode,lsbkpt,numbkp,iorder,jmnode,iur,iuc,ilc,ilr,numoff,isr, >*/
- /*< 3 nmoffc,iseq,iseq1,neqn,nodevs,ndiag,iswap,iequa,macins,lvnim1, >*/
- /*< 4 lx0,lvn,lynl,lyu,lyl,lx1,lx2,lx3,lx4,lx5,lx6,lx7,ld0,ld1,ltd, >*/
- /*< 5 imynl,imvn,lcvn,nsnod,nsmat,nsval,icnod,icmat,icval, >*/
- /*< 6 loutpt,lpol,lzer,irswpf,irswpr,icswpf,icswpr,irpt,jcpt, >*/
- /*< 7 irowno,jcolno,nttbr,nttar,lvntmp >*/
- /* spice version 2g.6 sccsid=miscel 3/15/83 */
- /*< common /miscel/ atime,aprog(3),adate,atitle(10),defl,defw,defad, >*/
- /*< 1 defas,rstats(50),iwidth,lwidth,nopage >*/
- /* spice version 2g.6 sccsid=cirdat 3/15/83 */
- /*< common /cirdat/ locate(50),jelcnt(50),nunods,ncnods,numnod,nstop, >*/
- /*< 1 nut,nlt,nxtrm,ndist,ntlin,ibr,numvs,numalt,numcyc >*/
- /* spice version 2g.6 sccsid=status 3/15/83 */
- /*< common /status/ omega,time,delta,delold(7),ag(7),vt,xni,egfet, >*/
- /*< 1 xmu,sfactr,mode,modedc,icalc,initf,method,iord,maxord,noncon, >*/
- /*< 2 iterno,itemno,nosolv,modac,ipiv,ivmflg,ipostp,iscrch,iofile >*/
- /* spice version 2g.6 sccsid=flags 3/15/83 */
- /*< common /flags/ iprnta,iprntl,iprntm,iprntn,iprnto,limtim,limpts, >*/
- /*< 1 lvlcod,lvltim,itl1,itl2,itl3,itl4,itl5,itl6,igoof,nogo,keof >*/
- /* spice version 2g.6 sccsid=knstnt 3/15/83 */
- /*< common /knstnt/ twopi,xlog2,xlog10,root2,rad,boltz,charge,ctok, >*/
- /*< 1 gmin,reltol,abstol,vntol,trtol,chgtol,eps0,epssil,epsox, >*/
- /*< 2 pivtol,pivrel >*/
- /* spice version 2g.6 sccsid=ac 3/15/83 */
- /*< common /ac/ fstart,fstop,fincr,skw2,refprl,spw2,jacflg,idfreq, >*/
- /*< 1 inoise,nosprt,nosout,nosin,idist,idprt >*/
- /* spice version 2g.6 sccsid=cje 3/15/83 */
- /*< common /cje/ maxtim,itime,icost >*/
- /* spice version 2g.6 sccsid=blank 3/15/83 */
- /*< common /blank/ value(200000) >*/
- /*< integer nodplc(64) >*/
- /*< complex cvalue(32) >*/
- /*< complex cendor >*/
- /*< equivalence (value(1),nodplc(1),cvalue(1)) >*/
- /*< call second(t1) >*/
- second_(&t1);
- /* .. post-processor initialization */
- /*< if(ipostp.eq.0) go to 1 >*/
- if (status_1.ipostp == 0) {
- goto L1;
- }
- /*< numcur=jelcnt(9) >*/
- numcur = cirdat_1.jelcnt[8];
- /*< numpos=nunods+numcur >*/
- numpos = cirdat_1.nunods + numcur;
- /*< call getm16(ibuff,numpos) >*/
- getm16_(&ibuff, &numpos);
- /*< numpos=numpos*4 >*/
- numpos <<= 2;
- /*< if(numcur.eq.0) go to 1 >*/
- if (numcur == 0) {
- goto L1;
- }
- /*< loc=locate(9) >*/
- loc = cirdat_1.locate[8];
- /*< loccur=nodplc(loc+6)-1 >*/
- loccur = nodplc[loc + 5] - 1;
-
- /* allocate storage */
-
- /*< 1 call getm8(ndiag,2*nstop) >*/
- L1:
- i_1 = cirdat_1.nstop << 1;
- getm8_(&tabinf_1.ndiag, &i_1);
- /*< call getm8(lvn,nstop+nttbr) >*/
- i_1 = cirdat_1.nstop + tabinf_1.nttbr;
- getm8_(&tabinf_1.lvn, &i_1);
- /*< call getm8(imvn,nstop+nttbr) >*/
- i_1 = cirdat_1.nstop + tabinf_1.nttbr;
- getm8_(&tabinf_1.imvn, &i_1);
- /*< call getm16(lcvn,nstop) >*/
- getm16_(&tabinf_1.lcvn, &cirdat_1.nstop);
- /*< if (idist.ne.0) call dinit >*/
- if (ac_1.idist != 0) {
- dinit_();
- }
- /*< nandd=0 >*/
- nandd = 0;
- /*< if (inoise.eq.0) go to 10 >*/
- if (ac_1.inoise == 0) {
- goto L10;
- }
- /*< if (idist.eq.0) go to 10 >*/
- if (ac_1.idist == 0) {
- goto L10;
- }
- /*< nandd=1 >*/
- nandd = 1;
- /*< call getm16(lvntmp,nstop) >*/
- getm16_(&tabinf_1.lvntmp, &cirdat_1.nstop);
- /*< 10 call getm16(loutpt,0) >*/
- L10:
- getm16_(&tabinf_1.loutpt, &c__0);
- /*< call crunch >*/
- crunch_();
- /*< numout=jelcnt(43)+jelcnt(44)+jelcnt(45)+1 >*/
- numout = cirdat_1.jelcnt[42] + cirdat_1.jelcnt[43] + cirdat_1.jelcnt[44]
- + 1;
- /*< lynl=lvn >*/
- tabinf_1.lynl = tabinf_1.lvn;
- /*< imynl=imvn >*/
- tabinf_1.imynl = tabinf_1.imvn;
- /*< lcvntp=lvntmp >*/
- lcvntp = tabinf_1.lvntmp;
- /*< icalc=0 >*/
- status_1.icalc = 0;
- /*< if (ipostp.ne.0) call pheadr(atitle) >*/
- if (status_1.ipostp != 0) {
- pheadr_(miscel_1.atitle);
- }
- /*< freq=fstart >*/
- freq = ac_1.fstart;
-
- /* load y matrix and c vector, solve for v vector */
-
- /*< 100 call getcje >*/
- L100:
- getcje_();
- /*< if ((maxtim-itime).le.limtim) go to 900 >*/
- if (cje_1.maxtim - cje_1.itime <= flags_1.limtim) {
- goto L900;
- }
- /*< omega=twopi*freq >*/
- status_1.omega = knstnt_1.twopi * freq;
- /*< call acload >*/
- acload_();
- /*< 110 call acdcmp >*/
- /* L110: */
- acdcmp_();
- /*< call acsol >*/
- acsol_();
- /*< if (igoof.eq.0) go to 200 >*/
- if (flags_1.igoof == 0) {
- goto L200;
- }
- /*< write (iofile,121) igoof,freq >*/
- io__13.ciunit = status_1.iofile;
- s_wsfe(&io__13);
- do_fio(&c__1, (char *)&flags_1.igoof, (ftnlen)sizeof(integer));
- do_fio(&c__1, (char *)&freq, (ftnlen)sizeof(doublereal));
- e_wsfe();
- /*< 121 format('0warning: underflow ',i4,' time(s) in ac analysis at freq >*/
- /*< 1 = ',1pd9.3,' hz') >*/
- /*< igoof=0 >*/
- flags_1.igoof = 0;
-
- /* store outputs */
-
- /*< 200 call extmem(loutpt,numout) >*/
- L200:
- extmem_(&tabinf_1.loutpt, &numout);
- /*< loco=loutpt+icalc*numout >*/
- loco = tabinf_1.loutpt + status_1.icalc * numout;
- /*< icalc=icalc+1 >*/
- ++status_1.icalc;
- /*< cvalue(loco+1)=cmplx(sngl(freq),sngl(omega)) >*/
- i_1 = loco;
- d_1 = freq;
- d_2 = status_1.omega;
- q_1.r = d_1, q_1.i = d_2;
- cvalue[i_1].r = q_1.r, cvalue[i_1].i = q_1.i;
- /*< loc=locate(43) >*/
- loc = cirdat_1.locate[42];
- /*< 310 if (loc.eq.0) go to 350 >*/
- L310:
- if (loc == 0) {
- goto L350;
- }
- /*< if (nodplc(loc+5).ne.0) go to 320 >*/
- if (nodplc[loc + 4] != 0) {
- goto L320;
- }
- /*< node1=nodplc(loc+2) >*/
- node1 = nodplc[loc + 1];
- /*< node2=nodplc(loc+3) >*/
- node2 = nodplc[loc + 2];
- /*< iseq=nodplc(loc+4) >*/
- tabinf_1.iseq = nodplc[loc + 3];
- /*< cvalue(loco+iseq)=cvalue(lcvn+node1)-cvalue(lcvn+node2) >*/
- i_1 = loco + tabinf_1.iseq - 1;
- i_2 = tabinf_1.lcvn + node1 - 1;
- i_3 = tabinf_1.lcvn + node2 - 1;
- q_1.r = cvalue[i_2].r - cvalue[i_3].r, q_1.i = cvalue[i_2].i - cvalue[i_3]
- .i;
- cvalue[i_1].r = q_1.r, cvalue[i_1].i = q_1.i;
- /*< loc=nodplc(loc) >*/
- loc = nodplc[loc - 1];
- /*< go to 310 >*/
- goto L310;
- /*< 320 iptr=nodplc(loc+2) >*/
- L320:
- iptr = nodplc[loc + 1];
- /*< iptr=nodplc(iptr+6) >*/
- iptr = nodplc[iptr + 5];
- /*< iseq=nodplc(loc+4) >*/
- tabinf_1.iseq = nodplc[loc + 3];
- /*< cvalue(loco+iseq)=cvalue(lcvn+iptr) >*/
- i_1 = loco + tabinf_1.iseq - 1;
- i_2 = tabinf_1.lcvn + iptr - 1;
- cvalue[i_1].r = cvalue[i_2].r, cvalue[i_1].i = cvalue[i_2].i;
- /*< loc=nodplc(loc) >*/
- loc = nodplc[loc - 1];
- /*< go to 310 >*/
- goto L310;
- /*< 350 if(ipostp.eq.0) go to 400 >*/
- L350:
- if (status_1.ipostp == 0) {
- goto L400;
- }
- /*< cvalue(ibuff+1)=cmplx(sngl(freq),0.0e0) >*/
- i_1 = ibuff;
- d_1 = freq;
- q_1.r = d_1, q_1.i = (float)0.;
- cvalue[i_1].r = q_1.r, cvalue[i_1].i = q_1.i;
- /*< call copy16(cvalue(lcvn+2),cvalue(ibuff+2),nunods-1) >*/
- i_1 = cirdat_1.nunods - 1;
- copy16_(&cvalue[tabinf_1.lcvn + 1], &cvalue[ibuff + 1], &i_1);
- /*< if(numcur.ne.0) call copy16(cvalue(lcvn+loccur+1), >*/
- /*< 1 cvalue(ibuff+nunods+1),numcur) >*/
- if (numcur != 0) {
- copy16_(&cvalue[tabinf_1.lcvn + loccur], &cvalue[ibuff +
- cirdat_1.nunods], &numcur);
- }
- /*< call dblsgl(cvalue(ibuff+1),numpos) >*/
- dblsgl_(&cvalue[ibuff], &numpos);
- /*< call fwrite(cvalue(ibuff+1),numpos) >*/
- fwrite_(&cvalue[ibuff], &numpos);
-
- /* noise and distortion analyses */
-
- /*< 400 if (nandd.eq.0) go to 410 >*/
- L400:
- if (nandd == 0) {
- goto L410;
- }
- /*< call copy16(cvalue(lcvn+1),cvalue(lcvntp+1),nstop) >*/
- copy16_(&cvalue[tabinf_1.lcvn], &cvalue[lcvntp], &cirdat_1.nstop);
- /*< 410 if (inoise.ne.0) call noise(loco) >*/
- L410:
- if (ac_1.inoise != 0) {
- noise_(&loco);
- }
- /*< if (nandd.eq.0) go to 420 >*/
- if (nandd == 0) {
- goto L420;
- }
- /*< call copy16(cvalue(lcvntp+1),cvalue(lcvn+1),nstop) >*/
- copy16_(&cvalue[lcvntp], &cvalue[tabinf_1.lcvn], &cirdat_1.nstop);
- /*< 420 if (idist.ne.0) call disto(loco) >*/
- L420:
- if (ac_1.idist != 0) {
- disto_(&loco);
- }
-
- /* increment frequency */
-
- /*< if (icalc.ge.jacflg) go to 1000 >*/
- if (status_1.icalc >= ac_1.jacflg) {
- goto L1000;
- }
- /*< if (idfreq.ge.3) go to 510 >*/
- if (ac_1.idfreq >= 3) {
- goto L510;
- }
- /*< freq=freq*fincr >*/
- freq *= ac_1.fincr;
- /*< go to 100 >*/
- goto L100;
- /*< 510 freq=freq+fincr >*/
- L510:
- freq += ac_1.fincr;
- /*< go to 100 >*/
- goto L100;
-
- /* finished */
-
- /*< 900 write (iofile,901) >*/
- L900:
- io__18.ciunit = status_1.iofile;
- s_wsfe(&io__18);
- e_wsfe();
- /*< 901 format('0*error*: cpu time limit exceeded ... analysis stopped'/) >*/
- /*< nogo=1 >*/
- flags_1.nogo = 1;
- /*< 1000 if(ipostp.eq.0) go to 1010 >*/
- L1000:
- if (status_1.ipostp == 0) {
- goto L1010;
- }
- /*< if (ipostp.ne.0) call clsraw >*/
- if (status_1.ipostp != 0) {
- clsraw_();
- }
- /*< if(ipostp.ne.0) call clrmem(ibuff) >*/
- if (status_1.ipostp != 0) {
- clrmem_(&ibuff);
- }
- /*< 1010 call clrmem(lvnim1) >*/
- L1010:
- clrmem_(&tabinf_1.lvnim1);
- /*< call clrmem(lx0) >*/
- clrmem_(&tabinf_1.lx0);
- /*< call clrmem(lvn) >*/
- clrmem_(&tabinf_1.lvn);
- /*< call clrmem(imvn) >*/
- clrmem_(&tabinf_1.imvn);
- /*< call clrmem(lcvn) >*/
- clrmem_(&tabinf_1.lcvn);
- /*< call clrmem(ndiag) >*/
- clrmem_(&tabinf_1.ndiag);
- /*< if (idist.eq.0) go to 1020 >*/
- if (ac_1.idist == 0) {
- goto L1020;
- }
- /*< call clrmem(ld0) >*/
- clrmem_(&tabinf_1.ld0);
- /*< call clrmem(ld1) >*/
- clrmem_(&tabinf_1.ld1);
- /*< 1020 if (nandd.eq.0) go to 1040 >*/
- L1020:
- if (nandd == 0) {
- goto L1040;
- }
- /*< call clrmem(lvntmp) >*/
- clrmem_(&tabinf_1.lvntmp);
- /*< 1040 call second(t2) >*/
- L1040:
- second_(&t2);
- /*< rstats(7)=rstats(7)+t2-t1 >*/
- miscel_1.rstats[6] = miscel_1.rstats[6] + t2 - t1;
- /*< rstats(8)=rstats(8)+icalc >*/
- miscel_1.rstats[7] += status_1.icalc;
- /*< return >*/
- return 0;
- /*< end >*/
- } /* acan_ */
-
- #undef cvalue
- #undef nodplc
-
-
-